<template>
    <div class="app-container">
        <!-- 基础信息 -->
        <h5 class="titleInfo">
            团队关系调整
        </h5>
        <el-form class="form" ref="form" :rules="rules" :model="form" label-width="136px">
            <el-row>
                <el-col :span="12">
                    <el-form-item label="美学设计师姓名" prop="name">
                        <el-input v-model="form.name"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="美学设计师手机号" prop="name">
                        <el-input v-model="form.name"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="美学设计师级别" prop="name">
                        <el-input v-model="form.name"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="是否带团队" prop="name">
                        <el-select placeholder="请选择" v-model="val">
                            <el-option label="1" value="1"></el-option>
                            <el-option label="2" value="2"></el-option>
                        </el-select>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="修改原因" prop="name">
                        <el-input v-model="form.name"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>

            <el-form-item>
                <el-button style="margin-top:30px" type="primary" @click="submitFn('form')" >立即提交</el-button>
            </el-form-item>
        </el-form>
    </div>
</template>
<script>
import uploadImg from '@/components/UploadImg/index'
import Tinymce from '@/components/Tinymce'
import { hospitalAdd } from '@/api/hospitalAdd'
import { companyList } from '@/api/branchOfficeDropDown'
import { loanDropDown } from '@/api/loanDropDown'
import { findHospitalTagsList } from '@/api/hospitalLabel'


export default {
    name:"designerInfoTeam",
    data(){
        return {
            val:"1",
            form:{
                name:"",

            },
            rules: {
                name: [
                    { required: true, message: '请输入医院名称', trigger: 'blur' },
                ]
            },
        }
    },
    components:{uploadImg,Tinymce},
    created(){

    },
    mounted(){

    },
    methods:{
        // 修改提交
        submitFn(e){
            this.$refs[e].validate((valid) => {
                if (valid) {
                    this.form.logo = this.$refs.uploadImg1.submitUpload()[0]
                    this.form.imageList = this.$refs.uploadImg2.submitUpload()
                    // this定义
                    let tf = this.form
                    for(var n in tf){
                        if(tf.hasOwnProperty(n)){
                            if(tf[n].length){
                                continue;
                            }
                            if(+tf[n]!==undefined){
                                tf[n] += "";
                            }
                        }
                    }
                    let datas = this.form
                    hospitalAdd(datas).then(res=>{
                        if(!res.data.code){
                            this.$message({
                                showClose: true,
                                message: '添加成功',
                                type: 'success'
                            });
                            this.$router.push('/hospitalIndex')
                        }else{
                            this.$message({
                                showClose: true,
                                message: res.data.msg,
                                type: 'warning'
                            });
                        }
                    })
                    .catch(error =>{
                        this.$message.error(error);
                    })
                }else{
                     this.$message({
                        message: '有必填项没填，不能提交咯',
                        type: 'warning'
                    });
                    return false;
                }
            });
        }
    }
}
</script>
<style scoped>
    .app-container{padding: 0.1px!important}
</style>
